#pragma once
#include "cgzCTcpWS.h"

class cgzCTcpGateWS : public cgzCTcpWS
{
public:
    cgzCTcpGateWS(
        cgzCThreadPool *pool,
        const char *name,
        const std::string ip,
        const int port,
        const int cid,
        const bool gate);
    virtual ~cgzCTcpGateWS();

public:
    virtual bool todoret(cgzCTcpFd *fdinfo, cgzHeader &header);
    virtual bool todoret(cgzCTcpFd *fdinfo, cgzGateHeader &header);
    bool run(cgzCLoopS *task) override;

protected:
    bool decodeProc(cgzCTcpFd *fdinfo, cgzCWDecode &de) override;

private:
    bool m_gate;
    //{[msgid] = targetid}
    std::unordered_map<int, int> m_gates;
};
